﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AccidenP = InsuranceCompany.Core.Domain.InsuranceObjects.Accident;

namespace InsuranceCompany.Client
{
    public partial class ListForm : InsuranceForm
    {
        public ListForm()
        {
            InitializeComponent();
        }
        public ListForm(List<AccidenP> payment, string title = "Список")
        {
            InitializeComponent();
            this.groupBox1.Text = title;
            this.PayListView.Items.Clear();
            foreach (AccidenP accident in payment)
            {
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SubItems[0].Text = accident.AccidentDate.ToShortDateString();
                listViewItem.SubItems.Add(accident.Description);
                listViewItem.SubItems.Add(accident.CalculatePaymentSum().ToString());
                
                this.PayListView.Items.Add(listViewItem);              
            }
        }
        
        private void Close_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
